package com.cn.qgx428.lazydiary.network.service

import com.cn.qgx428.lazydiary.network.bean.CommonResponse
import com.cn.qgx428.lazydiary.network.bean.User
import com.cn.qgx428.lazydiary.network.bean.UserInfoResponse
import retrofit2.http.*
import rx.Observable

/**
 * Created by qinguanxiong on 2018/1/10.
 */
interface UserService {

    @GET("User/index")
    fun test() : Observable<User>

    @FormUrlEncoded
    @POST("User/register")
    fun register(@Field("phone") phone:String,
                 @Field("pwd") pwd:String,
                 @Field("nickname") nickname:String): Observable<CommonResponse>

    @GET("User/login")
    fun login(@Query("phone") phone: String,
              @Query("pwd") pwd: String) : Observable<UserInfoResponse>

    @GET("User/getUserInfo")
    fun getUserInfo(@Query("id") id: Int): Observable<User>

    @FormUrlEncoded
    @POST("User/updateUserInfo")
    fun updateUserInfo(@Field("id") userId: Int,
               @Field("nickname") nickname: String,
               @Field("gender") gender: String,
               @Field("image") image: String) : Observable<CommonResponse>

    @GET("User/resetPwd")
    fun resetPwd(@Query("id") userId: Int,
                 @Query("originPwd") originPwd: String,
                 @Query("newPwd") newPwd: String): Observable<CommonResponse>
}